public class HungrySingletonFactory {

    private HungrySingletonFactory(){}
    //直接静态初始化
    private static final HungrySingletonFactory instance=new HungrySingletonFactory();
    //外部类获得单例对象方法
    public static HungrySingletonFactory getInstance(){
        return instance;
    }

    private String name;

    public String showInfo(){
        return Integer.toString(this.hashCode());
    }
    public String getName(){
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }

}
